package com.j.lemon.learn.basic.abstractimplements;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.List;

@Controller
public class Abstract1 implements InitializingBean{
    private final List<Implement1> implement1s;

    @Autowired
    public Abstract1(List<Implement1> implement1s) {
        this.implement1s = implement1s;
    }

    public void test(){
        for(Implement1 implement1: implement1s){
            implement1.say();
        }
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("initializingBean");
        test();
    }

    @PostConstruct
    public void ttt(){
        System.out.println("@PostConstruct");
    }
}
